<template>
	<div>
		<yh-table-select v-model="value" :apiObj="$API.system.user.list" :table-width="700" :props="props">
			<template #header="{form, submit}">
				<el-form :inline="true" :model="form">
					<el-form-item>
						<el-input v-model="form.username" clearable placeholder="姓名"></el-input>
					</el-form-item>
					<el-form-item>
						<el-button type="primary" @click="submit">查询</el-button>
					</el-form-item>
				</el-form>
			</template>
			<el-table-column label="姓名" prop="username" ></el-table-column>
			<el-table-column label="部门" prop="departmentTitle"></el-table-column>
		</yh-table-select>
	</div>
</template>

<script>
import YhTableSelect from "@/components/xunheng/yhTableSelect";
export default {
	name:"yhHumanResourceSelect",
	components: {YhTableSelect},
	props:['modelValue'],
	emits:['update:modelValue'],
	data(){
		return{
			value:"",
			props: {
				label: 'username',
				value: 'id',
				keyword: "username"
			},
		}
	},
	methods:{},
	watch:{
		value(val){
			this.$emit('update:modelValue',{id:val.id,username:val.username})
		},
	},
	async mounted() {
		if(!this.modelValue)return;
	/*	var res = await this.$API.system.user.getOneById.get(this.modelValue);
		if(res.success){
			this.value = {id:this.modelValue,username:res.data.username}
		}*/
		this.value = this.modelValue
	}
}
</script>

<style scoped>

</style>
